#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, M = 2e3 + 10, INF = 0x3f3f3f3f;

int n, m;
int a[N], b[M];

int main()
{
	cin >> n >> m;
	for(int i = 1;i <= n;i ++) cin >> a[i];
	for(int i = 1;i <= m;i ++) b[i] = 1;
	int l = 1, r = 1, len = INF, begin = 0;
	while(r <= n)
	{
		if(-- b[a[r]] == 0) m --;
		while(m == 0)
		{
			if(r - l + 1 < len)
			{
				begin = l;
				len = r - l + 1;
			}
			if(++ b[a[l ++]] == 1) m ++;
		}
		r ++;
	}
	cout << begin << " " << begin + len - 1 << endl;
	return 0;
}